import request from "@/common/request"

// 合同上传
export const contractUpload = (data) => {
    return request("post", "/contract/upload", data)
}

// 获取合同审查剩余额度
export const contractQuota = () => {
    return request("get", "/contract/quota")
}

// 获取合同审查结果
export const contractReview = (id) => {
    return request("get", "/contract/review", {
        id: id
    })
}

// 获取合同列表
export const contractList = (queryForm) => {
    return request("get", "/contract/list", queryForm)
}

// 获取合同详情
export const contractInfo = (id) => {
    return request("get", "/contract/info", {
        id: id
    })
}

// 删除合同
export const contractDelete = (id) => {
    return request("post", `/contract/delete?id=${id}`)
}

// 批量删除合同
export const contractDeleteBatch = (ids) => {
    return request("post", "/contract/deleteBatch", ids)
}

// 导出合同
export const contractExport = (data) => {
    return request("eptpost", "/contract/export", data)
}

// 获取合同审查规则列表
export const contractRuleList = () => {
    return request("get", "/contract/rule/list")
}

// 应用审查规则到合同
export const applyRuleToContract = (contractId, ruleIds) => {
    return request("post", `/contract/applyRules?contractId=${contractId}`, ruleIds)
}

// 获取合同类型列表
export const getContractTypeList = () => {
    return request("get", "/contractType/contractType/list")
}

// 保存合同信息和审核记录
export const saveContractAndReview = (contractDto) => {
    return request("post", "/contract/info/contract/saveWithReview", contractDto)
}

// 获取合同信息分页展示
export const pageContract = (contractDto, current, size) => {
    return request("get", "/contract/info/contract/page", {
        ...contractDto,
        current: current,
        size: size
    })
}

// 级联删除合同及关联数据
export const cascadeDeleteContract = (contractId) => {
    return request("post", `/contract/info/contract/cascadeDelete?contractId=${contractId}`)
}
